﻿using Caliburn.Micro;
using myapp.Databases.DAO;
using myapp.Events;
using myapp.Events.ViewModel;
using myapp.Instances;
using myapp.ViewModels;
using myappcore.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace myapp.ViewModels
{
    /// <summary>
    /// List Possition View Model
    /// </summary>
    public class PossitonManagerViewModel : IFunctionViewModel
    {
        #region Attribute
        private static PossitonManagerViewModel _instance;

        #endregion

        #region Properties

        /// <summary>
        /// Possition Group List View Model
        /// </summary>
        public Screen PossitionGroupView { get; set; }

        /// <summary>
        /// Possition List View Model
        /// </summary>
        public Screen PossitionView { get; set; }

        /// <summary>
        /// Instance of PossitionManagerViewModel
        /// </summary>
        public static PossitonManagerViewModel Instance
        {
            get
            {
                if (null == _instance)
                {
                    _instance = new PossitonManagerViewModel();
                }

                return _instance;
            }
        }

        #endregion

        #region Constructure

        public PossitonManagerViewModel()
        {
            Code = typeof(PossitonManagerViewModel).ToString();
            PossitionGroupView = PossitionGroupListViewModel.Instance;
            PossitionView = PossitionListViewModel.Instance;
            MainInstance.Instance.EventAggregator.Subscribe(this);

            if (PossitionGroupListViewModel.Instance.PossitionGroupViewList.Count > 0)
            {
                MainInstance.Instance.EventAggregator.Publish(new ViewModelPossitionGroupSelectedEvent()
                {

                    PossitionGroupViewModel = PossitionGroupListViewModel.Instance.PossitionGroupViewList[0]
                });
            }
        }
        #endregion

        #region Method

        #endregion
    }
}
